package com.ebeitech.doorapp.domain.dao;

import com.ebeitech.doorapp.db.CommonDBHelper;
import com.ebeitech.doorapp.db.DBChangeInterface;
import com.ebeitech.doorapp.db.dao.BaseDBDaoImpl;
import com.ebeitech.doorapp.domain.AppInfo;

import java.util.List;

/**
 * Created by alice on 2017/10/24.
 */
public class AppInfoDao extends BaseDBDaoImpl<AppInfo> implements DBChangeInterface {

	private static AppInfoDao appInfoDao;

	public static AppInfoDao getInstance() {

		if(appInfoDao == null || appInfoDao.dbHelper == null){
			appInfoDao = new AppInfoDao();
		}
		return appInfoDao;
	}

	public AppInfoDao() {
		super(CommonDBHelper.getDBHelper(), AppInfo.class);
		CommonDBHelper.addToDaoManager(this);
	}

	public List<AppInfo> getAppList(String selection){
		return queryList(null, selection, null);
	}

	@Override
	public void DBChange() {
		appInfoDao = null;
	}
}
